  var dropShadow = "progid:DXImageTransform.Microsoft.dropshadow(Offx=10,Offy=5,Color=C0C0C0,Positive=true)";
  dropShadow = "progid:DXImageTransform.Microsoft.Shadow(color=gray, Direction=135, Strength=7)";
  var NoVideoMessage = "This account does not have video support activated.";
  var ActivateVideoURL = "/ftweb/bin/ft.dll/buyspace";
  var OverBandwidthMessage = "This account has exceeded the monthly bandwidth allotment so support for videos have been disabled.";
  var BuyMoreBandwidthURL = "/ftweb/bin/ft.dll/buyspace";  
  var AutoPlayQuickTime = true;
  var CRLF = "\r\n";  		 

  function debugHtml(html) {
    var ta = document.getElementById("debugta");
	if (ta) {
      ta.value = html; 
	} else {
      alert(html);
	}
  }

  // construction for transitions
  function TTransition(aname, afilterstr) {
    this.ndx = null;
    this.tname = aname;
    this.filterstr = afilterstr;
    this.parent = null;
    return this;
  }
  
  function TSlideComment(adate,abywho,acomment,aguestuserid) {
    this.date = adate;
    this.bywho = abywho;
    this.comment = acomment;
    this.ndx = null;
    this.guestuserid = aguestuserid;
  }

  TSlideComment.prototype.toString = function() {
    var retval = "";
	retval += "date: " + this.date;
	retval += " - ";
	retval += "bywho:" + this.whoLink();
	retval += " - ";
	retval += "comment:" + this.comment;
	return retval;		
  }

  
  TSlideComment.prototype.whoLink = function() {
    var html = "";
    if (this.guestuserid != "") {
      html += '<a class=sscomments href="/ftweb/bin/ft.dll/guest?userid=' + this.guestuserid + '">';
      html += this.bywho;
      html += '</a>';
    } else {
      html += this.bywho;
    }
    return(html);
  }


  TSlideComment.prototype.tRow = function() {
    var retval = "";
	retval += "<tr>";
	retval += "<td width=60 class=sscomments nowrap>" + this.date + "</td>";	
	retval += "<td width=100 class=sscomments nowrap>" + this.whoLink() + "</td>";	
	retval += "<td class=sscomments>" + this.comment + "</td>";			
	retval += "</tr>";	
	return retval;
  }

  // constructor for a slide (1 frame of the slideshow)
  function slide(apictid,aextension,aorigvideoextension,acaption,abestprintsize,awidth,aheight,adispwidth,adispheight,aprivate, avideo, amoddate, apictdate, atags, ahasgpsdata, aalbumid, agroupid, aallowguestpurchases, aallowguestedit,afeaturepasswordvalidated, aalloworigaccess, ausewatermarks, aorigfilename)
  {
    this.ndx = null;
    this.pictid = apictid;
    this.caption = acaption;
    this.extension = aextension;
    this.bestPrintSize = abestprintsize;
    this.width = awidth;
    this.height = aheight;
    this.displaywidth = adispwidth;
    this.displayheight = adispheight;
    this.bottomString = null;
    this.calculatedCaptions = false;
    this.parent = null;
    this.id = 'thumb' + apictid;
    this.picture = null;
    this.isprivate = aprivate;
    this.isvideo = avideo;
    this.moddatetime = amoddate;
    this.pictdate = apictdate;
    this.origvideoextension = aorigvideoextension;
    this.comments = [];
    this.tags = atags;
    this.hasGPSData = ahasgpsdata;
    this.ratingCount = 0;
    this.averageRating = 0;
    this.viewCount = 0;
    this.incrementedViewCount = false;
    this.albumidstr = aalbumid;
    this.groupidstr = agroupid;
    this.allowGuestPurchases = aallowguestpurchases;
    this.allowGuestEdit = aallowguestedit;
    this.featurePasswordValidated = afeaturepasswordvalidated;
    this.allowOrigAccess = aalloworigaccess;
    this.useWatermarks = ausewatermarks;
    this.origfilename = aorigfilename;
             
    return this;
  }

  slide.prototype.debugInfo = function() {
	 var di = "";
  	 var CRLF = "\r\n";  		 
	 di += "Browser: " + useragent.agent + CRLF;
	 di += "Item Information" + CRLF;
	 di += "  url: " + this.imageVideoURL() + CRLF;
	 di += "  extension: " + this.extension + CRLF;
	 di += "  userid: " + this.parent.userid + CRLF;
	 di += "  pictureid: " + this.pictid + CRLF;		 
	 if (this.isvideo) di += "  isVideo: yes" + CRLF; else di += "  isVideo: no" + CRLF;
	 if (this.isprivate) di += "  isPrivate: yes" + CRLF; else di += "  isPrivate: no" + CRLF;		 
	 di += CRLF;
	 return(di);
  }

  // add user comments about this slide  
  slide.prototype.addComment = function(aComment) {
    aComment.ndx = this.comments.length;
    this.comments[this.comments.length] = aComment;
  }
  
  // create the caption and edit link that 
  // goes under the picture
  slide.prototype.captionHtml = function() {
    var html = "";
	if (this.calculatedCaptions == false) this.calculateCaptions();

	var TmpCaption = this.bottomString;
	var SingleLineCaption = this.caption.length < 50;
	
		
	// dump the caption
	html += "<table border=0><tr>";
	if ((TmpCaption != "") && (this.parent.showCaption)){
      html += "<td class=slidecaption>";
      html += TmpCaption;
      if ((this.parent.isGuest == false) && (SingleLineCaption)) html += " |";
      html += '</td>';
	}
	
	// dump the edit link
	if ((this.parent.isGuest == false) || (this.allowGuestEdit == 'ynYes') || (this.allowGuestEdit == 'ynYesPwd')) {
      if (SingleLineCaption == false) html += "</tr><tr>";
      html += "<td class=slidecaption align=center>";
      if (supportsYUI) {
        html += '<a href="';
        html += 'javascript:slideshow.showCaptionTags()"'
        html += ' class=slidebtmlink>Edit Caption & Tags</a>';
      } else {
        if ((this.parent.isGuest == false) || (this.featurePasswordValidated))
          html += '<a href="' + this.parent.baseURL + '&slideshow=0&editmode=t&ndx=' + this.ndx + '"'
        else
          html += '<a href="/ftweb/bin/ft.dll/getfeaturepassword?pictdetail' + '&slideshow=0&editmode=t&ndx=' + this.ndx + '"';
        html += ' class=slidebtmlink>Edit Caption & Tags</a>"';
      }
      html += "</td>";
    }
	
    html += "</tr></table>" + CRLF;  
	return html;
  }

  // fixup the captions
  slide.prototype.calculateCaptions = function ()
  {
    if (this.calculatedCaptions == false) {
      crre = /%13%10/g;
      apre = /'/g;
      qure = /"/g;
      brre = /<BR>/g;
      bsre = /\\/g;
	
      var cap = unescape(this.caption.replace(crre,'&nbsp;&nbsp;'));
      cap = cap.replace(/     /g, '');
      cap = cap.replace(/    /g, '');
      cap = cap.replace(/   /g, '');

      this.bottomString = cap;
      this.calculatedCaptions = true;
    }
  }

  slide.prototype.origHREF = function() {
    var url = '/' + this.pictid + '/origpict/' + escape(this.origfilename);
	
    if ((this.isvideo) && (this.parent.allowVideo == false)) {
      if (this.parent.isGuest) {
        url = 'javascript:alert(\'Video not supported for this FotoTime account.\')';  	  	  	  
      } else {
        url = ActivateVideoURL;  	  	    	  
      }
    }
		
	if ((this.isvideo) && (this.parent.overbandwidth == true)) {
	  if (this.parent.isGuest) {
	    url = 'javascript:alert(\'Video support has been disabled because this account has exceeded the monthly bandwidth allotment.\')';  	  	  	  
      } else {
        url = BuyMoreBandwidthURL;  	  	    	  
      }
    }	

    // return the url
    return (url);
  }
  
  slide.prototype.origVideoHREF = function() {
    if ((this.isvideo) && (this.origvideoext != "")) {
      var url = '/' + this.pictid + '/picture' + this.origvideoextension;	
    } else {
      var url = '/' + this.pictid + '/origpict/' + escape(this.origfilename);
	}
	
	if ((this.isvideo) && (this.parent.allowVideo == false)) {
	  if (this.parent.isGuest) {
	    url = 'javascript:alert(\'Video not supported for this FotoTime account.\')';  	  	  	  
	  } else {
	    url = ActivateVideoURL;  	  	    	  
	  }
	}
		
	if ((this.isvideo) && (this.parent.overbandwidth == true)) {
	  if (this.parent.isGuest) {
	    url = 'javascript:alert(\'Video support has been disabled because this account has exceeded the monthly bandwidth allotment.\')';  	  	  	  
	  } else {
	    url = BuyMoreBandwidthURL;  	  	    	  
	  }
	}	
		
	// return the url
    return (url);
  }


  slide.prototype.anchorHTML = function(aid) {
    var html = '<a';  
    if (aid != '') html += ' id=' + aid;	
    html += ' class=slidebtmlink title="Click here to see the original picture at full size."';
	
    if ((this.isvideo) && (this.parent.allowVideo == false)) {
      html += ' href="' + this.origHREF() + '">';	
      return html;  
    }

    if ((this.isvideo) && (this.parent.overbandwidth == true)) {
      html += ' href="' + this.origHREF() + '">';
	   return html;  
	}

    if (this.allowOrigAccess) {
	  html += ' href="' + this.origHREF() + '" target=_blank>';  	  
	  return html;
	}  else {
	  return '';
	}
  }

  slide.prototype.saveOrigHTML = function() {
   var url = '<a class=slidebtmlink href="/saveorig/' + this.pictid + '">';
   return (url);
  }


  slide.prototype.origAnchorHTML = function(aid) {
    var html = '<a';  
    if (aid != '') html += ' id=' + aid;	
    html += ' class=slidebtmlink title="Click here to see the original picture at full size."';
	
    if ((this.isvideo) && (this.parent.allowVideo == false)) {
      html += ' href="' + this.origVideoHREF() + '">';	
      return html;  
	}

    if ((this.isvideo) && (this.parent.overbandwidth == true)) {
      html += ' href="' + this.origVideoHREF() + '">';
	  return html;  
	}

    if (this.allowOrigAccess) {
	  html += ' href="' + this.origVideoHREF() + '" target=_blank>';  	  
	  return html;
	}  else {
	  return '';
	}
  }

  
 slide.prototype.fullScreenHTML = function() {
  var html = '';
  html += 'Size: ';
  //if (this.allowOrigAccess) html += this.origAnchorHTML('');
  html += this.width + 'x' + this.height;
  html += "</a>";
  if (this.allowOrigAccess) {
    html += ' (' + this.origAnchorHTML('')
    if (this.isvideo) 
      html += 'View Original</a>' + ' | ' + this.saveOrigHTML() + 'Download/Save</a>)'; 
    else 
      html += 'View Original</a>' + ' | ' + this.saveOrigHTML() + 'Download/Save</a>)';
  }
  return html;  
}

  slide.prototype.pictdateHTML = function() {
    var html = '';
    html += '<td class=slideshowbtmtxt align=center>' + this.pictdateStr() + '</td>'
    return html;  
  }

  slide.prototype.pictdateStr = function() {
    var html = '';
    if (this.pictdate == 0) html += '&nbsp;'; else html += 'Date:&nbsp;' + this.pictdate;
    return html;  
  }

slide.prototype.filenameStr = function() {
   var html = '';
   html += 'File Name: ' + unescape(this.origfilename);
   return html;
}

slide.prototype.pictdatefilenameStr = function() {
   var html = '';
   if (this.parent.showPictDate)
     html += this.pictdateStr();
   if (this.parent.showFileName) {
     if (html != '')
       html += '&nbsp;&nbsp;';
     html += this.filenameStr();
   }
   return html;
}


slide.prototype.pictGpsStr = function() {
  var html = '';
	if (this.hasGPSData) html += '<a class=slidebtmlink href="javascript:slideshow.showMap()">View on Google Map</a>';
	return html;
}

slide.prototype.getVideoMode = function() {
  var vcookie = GetCookie("vidPref");    

  var allowOrig = false;  
  if (this.parent.isGuest == false) allowOrig = true;
  if (this.allowOrigAccess) allowOrig = true;
  
  if ((vcookie == "x264") && (this.hasX264)) {
    return "x";
  } else
  if ((vcookie == "wmv") && (this.hasWMV)) {    
    return "w";
  } else
  if ((vcookie == "orig") && (allowOrig)) {    
    return "o";
  } else    
  if (this.hasX264) {
    return "x";
  } else
  if (this.hasWMV) {
    return "w";
  } else {
    return "o";   
  }
}

  
slide.prototype.videoSwitcher = function() {
  var html = "";
  var added = false;
  
  var vmode = this.getVideoMode();
  
  var allowOrig = false;  
  if (this.parent.isGuest == false) allowOrig = true;
  if (this.allowOrigAccess) allowOrig = true;
  if ((this.hasX264 == false) && (this.hasWMV == false)) allowOrig = true;
  
  html += 'View:&nbsp;&nbsp;';
  if (this.hasX264) {
    if (vmode == "x") html += '<a class=slidebtmlink href="javascript:slideshow.changeVideoMode(\'x264\')"><b>High Quality</b></a>';
    else html += '<a class=slidebtmlink href="javascript:slideshow.changeVideoMode(\'x264\')">High Quality</a>';    
    added = true;
  }
  
  if (this.hasWMV) {
    if (added) html += ' / ';
    if (vmode == "w") html += '<a class=slidebtmlink href="javascript:slideshow.changeVideoMode(\'wmv\')"><b>Standard Quality</b></a>';  
    else html += '<a class=slidebtmlink href="javascript:slideshow.changeVideoMode(\'wmv\')">Standard Quality</a>';  
    added = true;
  }
  
  if (allowOrig) {  
    if (added) html += ' / ';
    if (vmode == "o") html += '<a class=slidebtmlink href="javascript:slideshow.changeVideoMode(\'orig\')"><b>Original</b></a>';
    else html += '<a class=slidebtmlink href="javascript:slideshow.changeVideoMode(\'orig\')">Original</a>';
    added = true;
  }
  return html;
}


slide.prototype.topRowCell = function(col) {
  var html = "";
  
  if (this.isvideo) {
    if (col == 1) html = this.videoSwitcher();
  } else { 
    if (this.allowBuyPrints()) {
      if (col == 1) {
        html += '        <table border=0 cellspacing=0 cellpadding=0>' + CRLF;
        html += '          <tr>' + CRLF;
        html += '            <td valign=bottom><a href="' + this.parent.baseURL + "&slideshow=0&shopmode=t&ndx=" + this.ndx + '"><img border=0 src="' + this.parent.cartIconURL + '"></a></td>' + CRLF;
        html += '            <td valign=middle class=slideshowbtmtxt><a class=slidebtmlink href="javascript:slideshow.buyCurrentPrint()">Buy Prints &amp; Gifts</a></td>' + CRLF;
        html += '          </tr>' + CRLF;
        html += '        </table>' + CRLF;
      }
      
      if (col == 2) {
        if (this.parent.showPrintQuality) {
          html += 'Prints best up to: <a class=slidebtmlink id=msgbestprintsize href="javascript:slideshow.buyCurrentPrint()">' + this.bestPrintSize + '</a>' + CRLF;    
        } else {
          html += 'Prints best up to: <a class=slidebtmlink id=msgbestprintsize href="javascript:slideshow.buyCurrentPrint()">30x40</a>' + CRLF;            
        }
      }
    }
  } 
  
  return(html);
}

  
  slide.prototype.infoWindow = function () {
    var html = "";

    html += "<table width=480 cellpadding=0 cellspacing=0 class=slidebtmtbl style='border-collapse: collapse'>" + CRLF;		
    html += "  <tr><td width=100%>" + CRLF;
    html += "    <table width=100% border=0>" + CRLF;
    
    // output this row only if allowed to buy prints or has a picture date
    var trc1 = this.topRowCell(1);
    var trc2 = this.topRowCell(2);
    if ((trc1 == "") && (trc2 == "")) {
      html += '<tr id=toprow style="display:none">';
      html += '<td id=topRowCell_1 class=slideshowbtmtxt>&nbsp;</td>';
      html += '<td id=topRowCell_2 class=slideshowbtmtxt align=right>&nbsp;</td>';    
      html += '</tr>';    
    } else {
      html += '<tr id=toprow style="display:table-row">';
      if (trc1 != "") html += '<td id=topRowCell_1 class=slideshowbtmtxt>' + trc1 + '</td>'; else html += '<td id=topRowCell_1 class=slideshowbtmtxt>&nbsp;</td>';
      if (trc2 != "") html += '<td id=topRowCell_2 class=slideshowbtmtxt align=right>' + trc2 + '</td>'; else html += '<td id=topRowCell_2 class=slideshowbtmtxt align=right>&nbsp;</td>';    
      html += '</tr>';      
    }    
    
    // row gives access to orig and exif
    html += '    <tr>' + CRLF;
    html += '      <td class=slideshowbtmtxt align=left id=msgsize>' + this.fullScreenHTML() + '</td>' + CRLF;
    html += '      <td class=slideshowbtmtxt align=right>' + CRLF;
    html += '        <table border=0 cellspacing=0 cellpadding=0>' + CRLF;
    html += '          <tr>' + CRLF;
  	if ((this.parent.isGuest) && (!this.parent.showGuestsEXIFIPTC)) {
      html += '            <td colspan=2 class=slideshowbtmtxt>&nbsp;</td>';	
  	} else {
      html += '            <td valign=middle class=slideshowbtmtxt>';	
      if (this.isvideo) {
  	    html += '<a title="View Metadata" class=slidebtmlink href="javascript:slideshow.showCurrentEXIF()" id=metaDataLink>More video info</a>';      
      } else {
  	    html += '<a title="View Metadata" class=slidebtmlink href="javascript:slideshow.showCurrentEXIF()" id=metaDataLink>More photo info</a>';
      }
   	  html += '</td>' + CRLF;	  
      html += '            <td valign=bottom><a href="javascript:slideshow.showCurrentEXIF()"><img border=0 src="' + this.parent.infoIconURL + '"></a></td>' + CRLF;	  
	  }  

    html += '          </tr>' + CRLF;
    html += '        </table>' + CRLF;
    html += '      </td>' + CRLF;
    html += '    </tr>' + CRLF;

	// put in an extra row for rankings if pref is turned on
	if (this.parent.allowPhotoRankings) {
      html += '    <tr>' + CRLF;
      html += '      <td align=left id=ratingscell>' + this.ratingHTML() + '</td>' + CRLF;
      html += '      <td class=slideshowbtmtxt align=right id=viewscell>' + this.viewCountHTML() + '</td>' + CRLF;
      html += '    </tr>' + CRLF;			
	} else {
      html += '    <tr>' + CRLF;
      html += '      <td align=left>&nbsp;</td>' + CRLF;
      html += '      <td class=slideshowbtmtxt align=right id=viewscell>' + this.viewCountHTML() + '</td>' + CRLF;
      html += '    </tr>' + CRLF;			   
    }

    // row for comment window
    if ((this.parent.allowPhotoComments) && (!this.parent.isReal)) {
      if (this.comments.length > 0) {
 	    html += "<TR id=commentstr name=commentstr>" + CRLF;
	    html += "<td colspan=2 id=commentstd name=commentstd>" + CRLF;
	    html += this.commentHTML() + CRLF;
	    html += "</td>" + CRLF;
        html += "</tr>" + CRLF; 
      } else {
  	    html += "<TR id=commentstr name=commentstr>" + CRLF;	  
        html += "<td colspan=2 id=commentstd name=commentstd>" + CRLF;
	    //html += "&nbsp;";
	    html += this.commentHTML() + CRLF;
	    html += "</td>" + CRLF;		
        html += "</tr>" + CRLF; 		
      }
    }

    html += '    </table>' + CRLF;
    html += '  </td></tr>' + CRLF;
    html += '</table>' + CRLF;  
    return html;
  }
  
  slide.prototype.viewCountHTML = function() {
    // increment view count as we view it
	// so that we count this current view
	if (!this.incrementedViewCount) {
      this.viewCount++;
      this.incrementedViewCount = true;
    }		
		
	var html = '        Viewed: ' + this.viewCount + ' time';
	if (this.viewCount != 1) html += 's';	
    return(html);
  }
	


  slide.prototype.ratingHTML = function() {
    var html = "";
    html += '<table border=0 cellspacing=0 cellpadding=0 class=sscomments style="margin-top:10px">' + CRLF;
    html += '<tr>' + CRLF;
	html += '<td colspan=2 id=ratetext class=slideshowbtmtxt>Rate this ';
	if (this.isvideo) html += 'video'; else html += 'photo';
	html += '</td>' + CRLF;
	html += '</tr>' + CRLF + '<tr>' + CRLF;
    html += '<td id=ratestars class=slideshowbtmtxt>' + CRLF + this.starHTML() + '</td>' + CRLF;
    html += '<td id=ratecount class=slideshowbtmtxt>' + this.ratingCountHTML() + '</td>' + CRLF;
    html += '</tr>' + CRLF;
    html += '</table>' + CRLF;
	return(html);
  }


  // note - this is called from the cast vote function so I can
  // update the array with the current values in case the person
  // comes back to this slide
  slide.prototype.voteCallback = function(aAverageRating,aVoteCount) {
    var slide = slideshow.slides[slideshow.curIndex];		
	slide.averageRating = aAverageRating;
	slide.ratingCount = aVoteCount;
  }	

	
  slide.prototype.starHTML = function() {
	var html = "";		
	voteEvent = this.voteCallback;

    var Star     = '<img src="/ftweb/images/ft/star_sm.gif"';
    var StarHalf = '<img src="/ftweb/images/ft/star_sm_half.gif"';
    var StarNone = '<img src="/ftweb/images/ft/star_sm_bg.gif"';
	
	var allowEdits = true;

    var Whole = Math.floor(this.averageRating);
    var Decimal = this.averageRating - Whole;
    if (Decimal >= 0.5) Half = 1; else Half = 0;
    var Empty = 5 - Whole - Half;
		
		// setup global ratings variables
    if (allowEdits) {
      origItemRating = this.averageRating;
      voteResponseMessage = "";
      itemRated = false;
      if (this.isvideo) ratingVideo = true; else ratingVideo = false;
	}

    // 1/2 star rating is lowest if we have any votes
    if ((this.averageRating < 0.5) && (this.averageRating > 0)) Half = 1;
		
    var Curvote = 1;

		// whole stars
    for (var i = 1; i <= Whole; i++) {
      html += Star;
      if (allowEdits) html += this.starEvents(Curvote);
      html += '>' + CRLF;
      Curvote++;
	}

    // half stars
    for (var i = 1; i <= Half; i++) {
      html += StarHalf;
      if (allowEdits) html += this.starEvents(Curvote);
      html += '>' + CRLF;
      Curvote++;			
    }

    // empty stars
    for (var i = 1; i <= Empty; i++) {
      html += StarNone;
      if (allowEdits) html += this.starEvents(Curvote);
      html += '>' + CRLF;
      Curvote++;			
	}
	
    return(html);				
  }
	
  slide.prototype.starEvents = function(curVote) {
    var html = "";
    html += ' id="star' + curVote + '"';		
    html += ' onmousemove="slideshow.ssratehint(' + curVote + ')"';
    html += ' onmouseout="slideshow.ssrateout()"';
    html += ' onclick="slideshow.ssrateitem(' + curVote + ')"';
    html += ' hspace=0 vspace=0 style="margin:0; padding:0; border:0"';
	//html += ' alt="' + rateString(curVote) + '"';
	return(html);
  }
	
	
  slide.prototype.ratingCountHTML = function() {
    if (this.ratingCount > 0) {
      var html = '(' + this.ratingCount + ' rating';
      if (this.ratingCount != 1) html += 's';
	  html += ')';
	} else {
      var html = '(Not yet rated)';		
	}
	
	return(html);
  }
	
  slide.prototype.needRatingHack = function() {
		var retval = false;
		if ((this.isvideo) && (useragent.isie) && (this.usingQuickTimePlayer())) retval = true;
		return(retval);
	}
 
  slide.prototype.usingQuickTimePlayer = function() {
	var ctl = vplayer.control;
	return(ctl == 'qtax');
  }
 
  slide.prototype.commentHTML = function() {
    var html = "";
    if (this.comments.length > 0) {
      html += "<HR class=sscomments>";
      html += "<table cellspacing=0 class=sscomments>";
      html += "<tr><td colspan=3 class=sscomments><font class=sscomments>Recent Comments about photo</font> - <a href='javascript:slideshow.addNewComment()' class=sscomments>Add your comments</a> - <a href='javascript:slideshow.viewAllComments()' class=sscomments>View all comments</a></td></tr>";  
      var i = 0;  
      while (i < this.comments.length) {
        var aComment = this.comments[i];
        html += aComment.tRow();
        i++;
      }
    } else {
      html += "<table cellspacing=0 class=sscomments width=100%>";  
      html += "<Tr><td class=sscomments align=center>There are no comments on this photo. Be the first to add <a class=sscomments href='javascript:slideshow.addNewComment()'>comments</a>.</td></tr>";
    }
    html += "</table>";
    return html;
  }

  // get the current server id from the cookie  
  // so videos work with loadbalancer
  slide.prototype.serverid = function() {
    // cookies are separated by semicolons
    var sName = "serverid";
    var aCookie = document.cookie.split("; ");
    for (var i=0; i < aCookie.length; i++) {
      // a name/value pair (a crumb) is separated by an equal sign
      var aCrumb = aCookie[i].split("=");
      if (sName == aCrumb[0]) return unescape(aCrumb[1]); // found a match - return it
    }
 
    return null; // a cookie with the requested name does not exist
  }

  var tmpslide = null;

  // start video playing after dumping control down
  slide.prototype.startVideo = function() {
    vplayer.startVideo();
  } 
  


  slide.prototype.shutdownVideoPlayer = function() {
    if (this.isvideo) {
      vplayer.stopVideo();
      return;
	}
		
    if (this.isvideo) {
      if (this.parent.currentvideoplayer == "fototime") document.videoplayer.stop();	 	  		
  	  if (this.parent.currentvideoplayer == "newmediaplayer") {
        document.videoplayer.controls.stop();	 	  		
        document.videoplayer.close();
      }
      if (this.parent.currentvideoplayer == "oldmediaplayer") {
        document.videoplayer.stop();
        document.videoplayer.close();
      }
      if (this.parent.currentvideoplayer == "quicktime") {
        if (AutoPlayQuickTime) {
          document.videoplayer.Stop();
		  document.videoplayer.Hide();
	    }
      }
	  
    }	
  }


  slide.prototype.videoFinished = function() {
	slideshow.videoadvance();
  }

  // get the image/video URL for this slide
  slide.prototype.imageVideoURL = function() {
    var url = "";
	
    if (this.isvideo) {
	  var hostname = this.parent.hostname.toUpperCase();
	  var NeedTranslation = ((hostname.indexOf("FOTOTIME.COM") >= 0) || (hostname == "216.185.99.68") || (hostname.indexOf("REALPHOTOVIDEO.COM") >= 0));
	  var MachId = this.serverid();
	  var Host = this.parent.hostname;
	  if (NeedTranslation) {
            if (this.parent.isReal) {
		if (MachId == '0') Host = '69.64.165.170';
		if (MachId == '1') Host = '69.64.165.171';
		if (MachId == '2') Host = '69.64.165.172';
            } else {
		if (MachId == '1') Host = '69.64.165.181';
		if (MachId == '2') Host = '69.64.165.182';
		if (MachId == '3') Host = '69.64.165.183';
		if (MachId == '4') Host = '69.64.165.184';
		if (MachId == '5') Host = '69.64.165.185';
		if (MachId == '6') Host = '69.64.165.186';
		if (MachId == '7') Host = '69.64.165.187';
		if (MachId == '8') Host = '69.64.165.188';
		if (MachId == '9') Host = '69.64.165.189';
		if (MachId == '10') Host = '69.64.165.162';
		if (MachId == '11') Host = '69.64.165.163';
            }
	  }

    
    var vmode = this.getVideoMode();
    // x264
    if (vmode == "x") {
      url = 'http://' + Host + '/' + this.parent.guid + '/' + this.pictid + '/ftvideo_x264.mp4';	    
    } else
    // wmv
    if (vmode == "w") {    
      url = 'http://' + Host + '/' + this.parent.guid + '/' + this.pictid + '/ftvideo.wmv';	    
    // orig
    } else {
      url = 'http://' + Host + '/' + this.parent.guid + '/' + this.pictid + '/ftvideo' + this.origvideoextension;	    
    } 
    

	} else {
 	   url = "http://"  + this.parent.hostname + "/" + this.pictid;
           if ((this.parent.maxPicWidth == -1) && (this.allowOrigAccess))
           {
             url += "/origpict";
           }
           else
           {
             if (this.useWatermarks)
               url += "/watermarkpict"
             else
               url += "/standardpict";
           }
           url += '/exp=f&modt=' + this.moddatetime;			
           if (this.ndx != 0) url = url + '&ssdyn=1';

           //re = /%/g;

           //var filename = this.origfilename.replace(re,'');
           
           url += '/' + escape(this.origfilename);
	}
	return url;
  }

  // buffer/load image - dont load videos
  slide.prototype.loadImage = function() {
    if (this.picture == null) {
	    this.picture = new Image();
	    // dont preload videos
	    if (this.isvideo == false) this.picture.src = this.imageVideoURL();
	  }	
	  return (this.picture.complete);
  }


  // create the image/video tag to insert into the html
  slide.prototype.imageVideoTag = function(incBorderDiv,incTransDiv) {
    var html = "";
		
	  // if a video
	  if (this.isvideo) {
			
	    if (this.parent.allowVideo == false) {
	      html = "<font class=righttextbold>";
		    html += NoVideoMessage;
		    if (this.parent.isGuest == false) html += "<BR>Click here to activate video support for your FotoTime account.";
		    html += "</font>";
		    return html;
	    }

	    if (this.parent.overbandwidth == true) {
	      html = "<font class=righttextbold>";
		    html += OverBandwidthMessage;
		    if (this.parent.isGuest == false) html += "<BR> You can either purchase more bandwidth, or wait for your new bandwidth allotment at the beginning of the month.";
		    html += "</font>";
		    return html;
	    }  
	
			var VideoURL = this.imageVideoURL();	  
			this.parent.currentvideoplayer = "none";
			
			vplayer.url = VideoURL;
			vplayer.finishedFunction = this.videoFinished;
      vplayer.slideshowSize = this.parent.viewSizeCode;      
			if (vplayer.canControlViaJScript()) vplayer.autostart = false; else vplayer.autostart = true;
			var playerHtml = vplayer.toString();			

			return(playerHtml);
	    // it returns here - nothing else after this is used anymore
			// old code below

      if (!useragent.supportsActiveX) {
        html = "<table align=center border=0><tr><td class=slidecaption>Click <a class=slidebtmlink target=new href='" + this.imageVideoURL() + "'>here</a> to download video if it does not start playing above.</td></tr></table>";
     	  this.parent.currentvideoplayer = "link";
        return html;
      }
	  
			if (this.parent.isReal == true) {
				html += '<object codebase="/ftweb/activeX/RealPhotoVideoPlayer.cab#version=1,6,0,0" classid="clsid:42D29984-7448-4DB3-A54C-F611C4662891" id="videoplayer" name="videoplayer" width="540px" height="405px">';
				html += '<param name="ShowCommonPlayerControls" value="-1">';
				html += '<param name="ShowInternalPlayerControls" value="0">';
				html += '<param name="AutoStart" value="0">';		
				html += '<param name="Color" value="0">';
						//html += '<param name="URL" value="' + VideoURL + '">' + CRLF;		
				html += '<PARAM name="Align" value="1">';
				html += '</object>';
				html += '<script>';
		
				html += '  document.videoplayer.open("' + VideoURL + '",0>;' + CRLF;
				html += '</script>';
				html += '<script language="javascript" for="videoplayer" Event="OnDonePlaying()">';
				html += '  slideshow.videoadvance();';
				html += '</script>';
				html += "<table align=center border=0><tr><td class=slidecaption>Click <a class=slidebtmlink target=new href='" + this.origHREF() + "'>here</a> to download video if it does not start playing above.</td></tr></table>";
				this.parent.currentvideoplayer = "fototime";
				return html;
			}
	  	
	    // use quicktime viewer for MOV files
	    if (this.extension.toUpperCase() == '.MOV') {
	      html += '<table name=qttable id=qttable bgcolor=white border=0 cellspacing=0 cellpadding=0 width=540 height=405><tr><td width=540 height=405 height=100% bgcolor=white valign=middle align=center>' + CRLF;
		    if (AutoPlayQuickTime) {
		      html += '<OBJECT id=videoplayer CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"  WIDTH="540" HEIGHT="405" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">' + CRLF;
	        //html += 'xx  <param name="_ExtentX" value="12700">' + CRLF;
	        //html += 'xx  <param name="_ExtentY" value="7620">' + CRLF;
	        //html += 'xx  <param name="target" value="myself">' + CRLF;
		      html += '  <param name="enablejavascript" value="true">' + CRLF;
	        html += '  <param name="AUTOPLAY" value="false">' + CRLF;
		      html += '  <param name="CONTROLLER" value="true">' + CRLF;		
	        html += '  <param name="SRC" value="' + VideoURL + '">' + CRLF;
		      html += ' </OBJECT>' + CRLF;
		      html += '</td></tr></table>';
		    } else {
		      html += '<img border=0 src="http://images.apple.com/quicktime/home/images/quicktimelogo05202003.gif"><BR><BR>';
		    }
  	    this.parent.currentvideoplayer = "quicktime";
	    } else {
	      // windows media player
	      if (this.parent.useWindowsMediaPlayer) {
		  
		      if (this.parent.useNewMediaPlayer()) {		  
            html += '<object classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" width=540 height=405 id="videoplayer" VIEWASTEXT>' + CRLF;
    	      this.parent.currentvideoplayer = "newmediaplayer";					
          } else {
            html += '<object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" width=540 height=405 id="videoplayer" VIEWASTEXT>' + CRLF;
    	      this.parent.currentvideoplayer = "oldmediaplayer";								
          }		 	
					  
					html += '  <param name="AudioStream" value="-1">' + CRLF;
					html += '  <param name="AutoSize" value="0">' + CRLF;
					html += '  <param name="AutoStart" value="0">' + CRLF;
					html += '  <param name="AnimationAtStart" value="-1">' + CRLF;
					html += '  <param name="AllowScan" value="-1">' + CRLF;
					html += '  <param name="AllowChangeDisplaySize" value="-1">' + CRLF;
					html += '  <param name="AutoRewind" value="0">' + CRLF;
					html += '  <param name="Balance" value="0">' + CRLF;
					html += '  <param name="BaseURL" value>' + CRLF;
					html += '  <param name="BufferingTime" value="5">' + CRLF;
					html += '  <param name="CaptioningID" value>' + CRLF;
					html += '  <param name="ClickToPlay" value="-1">' + CRLF;
					html += '  <param name="CursorType" value="0">' + CRLF;
					html += '  <param name="CurrentPosition" value="-1">' + CRLF;
					html += '  <param name="CurrentMarker" value="0">' + CRLF;
					html += '  <param name="DefaultFrame" value>' + CRLF;
					html += '  <param name="DisplayBackColor" value="0">' + CRLF;
					html += '  <param name="DisplayForeColor" value="16777215">' + CRLF;
					html += '  <param name="DisplayMode" value="0">' + CRLF;
					html += '  <param name="DisplaySize" value="0">' + CRLF;
					html += '  <param name="Enabled" value="-1">' + CRLF;
					html += '  <param name="EnableContextMenu" value="-1">' + CRLF;
					html += '  <param name="EnablePositionControls" value="0">' + CRLF;
					html += '  <param name="EnableFullScreenControls" value="0">' + CRLF;
					html += '  <param name="EnableTracker" value="-1">' + CRLF;
					//html += '  <param name="Filename" VALUE="' + VideoURL + '">' + CRLF;
					html += '  <param name="InvokeURLs" value="-1">' + CRLF;
					html += '  <param name="Language" value="-1">' + CRLF;
					html += '  <param name="Mute" value="0">' + CRLF;
					html += '  <param name="PlayCount" value="1">' + CRLF;
					html += '  <param name="PreviewMode" value="0">' + CRLF;
					html += '  <param name="Rate" value="1">' + CRLF;
					html += '  <param name="SAMILang" value>' + CRLF;
					html += '  <param name="SAMIStyle" value>' + CRLF;
					html += '  <param name="SAMIFileName" value>' + CRLF;
					html += '  <param name="SelectionStart" value="-1">' + CRLF;
					html += '  <param name="SelectionEnd" value="-1">' + CRLF;
					html += '  <param name="SendOpenStateChangeEvents" value="-1">' + CRLF;
					html += '  <param name="SendWarningEvents" value="-1">' + CRLF;
					html += '  <param name="SendErrorEvents" value="-1">' + CRLF;
					html += '  <param name="SendKeyboardEvents" value="0">' + CRLF;
					html += '  <param name="SendMouseClickEvents" value="0">' + CRLF;
					html += '  <param name="SendMouseMoveEvents" value="0">' + CRLF;
					html += '  <param name="SendPlayStateChangeEvents" value="-1">' + CRLF;
					html += '  <param name="ShowCaptioning" value="0">' + CRLF;
					html += '  <param name="ShowControls" value="-1">' + CRLF;
					html += '  <param name="ShowAudioControls" value="-1">' + CRLF;
					html += '  <param name="ShowDisplay" value="0">' + CRLF;
					html += '  <param name="ShowGotoBar" value="0">' + CRLF;
					html += '  <param name="ShowPositionControls" value="-1">' + CRLF;
					html += '  <param name="ShowStatusBar" value="1">' + CRLF;
					html += '  <param name="ShowTracker" value="-1">' + CRLF;
					html += '  <param name="TransparentAtStart" value="0">' + CRLF;
					html += '  <param name="VideoBorderWidth" value="0">' + CRLF;
					html += '  <param name="VideoBorderColor" value="0">' + CRLF;
					html += '  <param name="VideoBorder3D" value="0">' + CRLF;
					html += '  <param name="Volume" value="67">' + CRLF;
					html += '  <param name="WindowlessVideo" value="0">' + CRLF;
					html += '</object>' + CRLF;
					html += '<script language="javascript" for="videoplayer" Event="PlayStateChange(newstate)"> ' + CRLF;
					html += '  if (newstate == 8) slideshow.videoadvance(); ' + CRLF;
					html += '</script> 		  ' + CRLF;
	      } else {
					// active movie player
					html += '<object classid="clsid:05589FA1-C356-11CE-BF01-00AA0055595A" id="videoplayer"  width="540" height="405">' + CRLF;
					html += '  <param name="Appearance" value="0">' +CRLF;
					html += '  <param name="AutoStart" value="1">' +CRLF;
					html += '  <param name="AllowChangeDisplayMode" value="-1">' +CRLF;
					html += '  <param name="AllowHideDisplay" value="0">' +CRLF;
					html += '  <param name="AllowHideControls" value="-1">' +CRLF;
					html += '  <param name="AutoRewind" value="-1">' +CRLF;
					html += '  <param name="Balance" value="0">' +CRLF;
					html += '  <param name="CurrentPosition" value="0">' +CRLF;
					html += '  <param name="DisplayBackColor" value="0">' +CRLF;
					html += '  <param name="DisplayForeColor" value="16777215">' +CRLF;
					html += '  <param name="DisplayMode" value="0">' +CRLF;
					html += '  <param name="Enabled" value="-1">' +CRLF;
					html += '  <param name="EnableContextMenu" value="-1">' +CRLF;
					html += '  <param name="EnablePositionControls" value="-1">' +CRLF;
					html += '  <param name="EnableSelectionControls" value="0">' +CRLF;
					html += '  <param name="EnableTracker" value="-1">' +CRLF;
					html += '  <param name="Filename" valuetype="ref" ref value="' + VideoURL + '">' +CRLF;
					html += '  <param name="FullScreenMode" value="0">' +CRLF;
					html += '  <param name="MovieWindowSize" value="0">' +CRLF;
					html += '  <param name="PlayCount" value="1">' +CRLF;
					html += '  <param name="Rate" value="1">' +CRLF;
					html += '  <param name="SelectionStart" value="-1">' +CRLF;
					html += '  <param name="SelectionEnd" value="-1">' +CRLF;
					html += '  <param name="ShowControls" value="1">' +CRLF;
					html += '  <param name="ShowDisplay" value="1">' +CRLF;
					html += '  <param name="ShowPositionControls" value="0">' +CRLF;
					html += '  <param name="ShowTracker" value="1">' +CRLF;
					html += '  <param name="Volume" value="-600">' +CRLF;
					html +='</object>'  +CRLF;
				}
	    }
	    html += "<table align=center border=0><tr><td class=slidecaption>Click <a class=slidebtmlink target=new href='" + this.origHREF() + "'>here</a> to download video if it does not start playing above.</td></tr></table>";
	  }
	  // just a simple image
	  else {
      this.parent.currentvideoplayer = "none";						


      // see if we are showing original size photos
      // if so, then set w,h to width,height
      // else set w,h to webwidth,webheight
      var origsize = this.parent.maxPicHeight == -1;
      if (origsize) {
        var w = this.width;
	var h = this.height;
	if (h <= 480) {
  	  var mw = w;
	  var mh = 480;
	} else {
          var mw = w;
          var mh = h;
	}
      } else {
	var w = this.displaywidth;
	var h = this.displayheight;
	var mw = this.parent.maxPicWidth;
	var mh = this.parent.maxPicHeight;
      }			

      if (this.isvideo) {
	var topgap = 0;
      } else {
	var topgap = 0;
        if (useragent.isie) {
	  if ((!origsize) && (topgap == 0)) topgap = (mh - h) / 2;
	  if ((origsize) && (topgap == 0) && (h <=480)) topgap = (mh - h) / 2;	
          topgap = Math.round(topgap);
          //topgap = 0;			
        }
      }

      // start building the img tag
      var imgtag = '<img border=0 galleryimg=false id=slidepic src="' + this.picture.src + '"';
      imgtag += ' height=' + h + ' width=' + w;			
      // special hint for account owner
      //if (this.parent.isGuest == false) html += ' onmouseover="slideshow.showExtraMenu()" onmouseout="slideshow.hideExtraMenu()"';
      //if (useragent.supportsFilters) html += ' style="filter:' + this.parent.getShadow() + '"';		
			
      // context menus
      if (this.parent.isGuest) {
        imgtag += ' oncontextmenu="return slideshowContextMenu()"';
      } else {
        imgtag += ' oncontextmenu="return slideshow.rightClickHint()"';				
      }
      //if (!incBorderDiv) imgtag += ' style="margin-top:' + top + 'px"';
      imgtag += '>' + CRLF;  

      // piclens span
      var ncPictId = noCurlys(this.pictid);
      if (this.parent.picLensEnabled) imgtag += '<span class="mbf-item">#piclens_gallery ' + ncPictId + '</span>';

      // wrap imgtag in anchor if necessary
      if (this.allowOrigAccess) {
        var aimgtag = this.anchorHTML("afs") + CRLF + imgtag + '</a>'; 
      } else {
        aimgtag = imgtag;
      }
				
      // now add border div (shadow)
      if (incBorderDiv) var bdr = this.getImageBorder(aimgtag,w,h,topgap); else var bdr = aimgtag;
			
		
      // now add transition div
      if ((incTransDiv) && (useragent.isie)) {
        html = '<div id=slidetrans';
        var trans = this.parent.getTransition();
        if ((useragent.supportsFilters) && (trans != null)) {
          // IMPORTANT - in order for transition to work - this div must have height/width specified
  	  if (origsize) {
  	    html += ' style="width:' + mw + 'px;height:' + mh + 'px';											
          } else {
	    html += ' style="width:' + mw + 'px;height:' + mh + 'px';					
          }
	  //html += ';border:1px solid red';
	  //html += ';filter:' + trans.filterstr;
	  html += '"'; // close style attribute
        } else {
          html += ' style="width:' + mw + 'px;height:' + mh + 'px"';
        }
        html += ">" + bdr + "</div>";
      } else {
	html = bdr;
      }
			
      //alert(html);
			
    }
    return html;
  }
 
 
  slide.prototype.getImageBorder = function(imghtml,w,h,topgap) {
		if (this.parent.slideShowShadow == "gshadow") { return(imgframeShadow(imghtml,w,h,topgap)) };
		if (this.parent.slideShowShadow == "psmallcorners") { return(imgframeSmallCorners(imghtml,w,h,topgap)) };		
		if (this.parent.slideShowShadow == "wood") { return(imgframeWood(imghtml,w,h,topgap)) };				
		if (this.parent.slideShowShadow == "spiral") { return(imgframeSpiral(imghtml,w,h,topgap)) };						
		if (this.parent.slideShowShadow == "slide") { return(imgframeSlide(imghtml,w,h,topgap)) };								
		if (this.parent.slideShowShadow == "flicking") { return(imgframeFlicking(imghtml,w,h,topgap)) };
		
    if (this.parent.slideShowShadow == "shadow") {
			if (useragent.isie) return(imgframeShadow(imghtml,w,h,topgap)); 
			else { return(imgframeShadow(imghtml,w,h,topgap)) }; 
		}

    if (this.parent.slideShowShadow == "dropshadow") {
			if (useragent.isie) return(imgframeClass(imghtml,w,h,topgap,this.parent.getBorderClass())); 
			else { return(imgframeShadow(imghtml,w,h,topgap)) }; 
		}

		if (this.parent.slideShowShadow == "thinline") { return(imgframeClass(imghtml,w,h,topgap,this.parent.getBorderClass())) };
		if (this.parent.slideShowShadow == "thickline") { return(imgframeClass(imghtml,w,h,topgap,this.parent.getBorderClass())) };		

    // firefox needs extra room for reflection
		if ((this.parent.slideShowShadow == "reflection") && (!useragent.isie)) h = h * 1.2;
		// firefox doesn't need the topgap for reflections - it auto centers
		if ((this.parent.slideShowShadow == "reflection") && (!useragent.isie)) topgap = 0;

    // default
		return(imgframeClass(imghtml,w,h,topgap,""));
  }
  
  // convert a thumbnail to a string
  slide.prototype.toString = function()
  {
    var html = "";
    this.loadImage();
    //if (this.allowOrigAccess) html += this.anchorHTML("afs");
    html += '      <span id=imgspan>' + CRLF;
    html += '        ' + this.imageVideoTag(true,true) + CRLF;
    html += '      </span>';
    //if (this.allowOrigAccess) html += '</a>';
    return html; 
  }


  slide.prototype.drawReflection = function() {
    var sp = document.getElementById("slidepic");
    if (sp) Reflection.add(sp, { height:0.2 });		
  }

  // replace the currently displayed picture or video with
  // the currently selected image/video
  slide.prototype.replacePic = function() {
    // sees whether we are currently displaying a video or an image
    var ihtml = document.getElementById("imgspan").innerHTML.toUpperCase();		
    var currentlyShowingImage = false;
    if (ihtml.indexOf("ID=SLIDEPIC") > 0) currentlyShowingImage = true;
    if (ihtml.indexOf('ID="SLIDEPIC"') > 0) currentlyShowingImage = true;
		
    var transition = null;
    if (useragent.supportsFilters) transition = this.parent.getTransition();
    
    if (this.isvideo) {
      slideshow.pauseMusic();    
    } else {
      if (currentlyShowingImage) {
      } else {
        slideshow.startMusic();      
      }
    }
    
	
    if ((!this.isvideo) && (currentlyShowingImage) && (transition != null))  {
      var img = document.getElementById("slidepic");
			
      if (transition) {
	var transdiv = document.getElementById("slidetrans");
        transdiv.style.filter = transition.filterstr;
        transdiv.filters[0].apply();
        var thtml = this.imageVideoTag(true,false);
	//alert(thtml);
	transdiv.innerHTML = thtml;
	if (this.parent.slideShowShadow == "reflection") this.drawReflection();				
        transdiv.filters[0].play();
        return;
      }
				
      img.width = 0; img.height=0;
      //img.src = ""; commented out this line - it was causing extra hits to our homepage
      if (transition) img.src = this.picture.src;
      if ((this.displaywidth == -1) || (this.displayheight == -1)) {
        img.width = this.width;
        img.height = this.height;		  
      } else {
       img.width = this.displaywidth;
       img.height = this.displayheight;	
      }
      if (!transition) img.src = this.picture.src;
			
      // replace anchor url so that it shows orig right
      var anc = document.getElementById("afs");
      if (anc) {
        anc.href = this.origHREF();
      }
      if (transition) transdiv.filters[0].Play();
      if (this.parent.slideShowShadow == "reflection") this.drawReflection();										
    } else {
      var html = this.imageVideoTag(true,true);
      var spn = document.getElementById("imgspan");
      spn.innerHTML = html;
      if (this.parent.slideShowShadow == "reflection") this.drawReflection();							
      if (this.isvideo) this.startVideo();
    }
  }


  var globalslide = null;

  
// this updates the screen for the currently active image/video
// WITHOUT REDRAWING everything - reduces flicker
slide.prototype.updateScreen = function() {
			
  // update picture
  var loaded = this.loadImage();
	
  // wait for image to load
  if ((loaded == false) && (this.isvideo == false)) {
	  this.busy(true);
	  globalslide = this;
	  setTimeout("globalslide.updateScreen()", 500);
	  return false;
	}


	// replace the currently displayed picture
  this.replacePic();
  
  // hide/show rotate icons (show if not video)    
  var rc = getE("rotateIcons");
  if (rc) {
    if (this.isvideo) rc.style.visibility = "hidden"; else rc.style.visibility = "visible";
  }   
	
  // update 1 of n indicator
  setHTML("slidendx", (this.parent.curIndex+1) + ' of ' + this.parent.slides.length);
	
  // update size
  setHTML("msgsize", this.fullScreenHTML());

  // picture date
  setHTML("msgpictdate", this.pictdatefilenameStr());
 	//document.getElementById("msggpsdata").innerHTML = this.pictGpsStr();

  // update ratings and views
	if (this.parent.allowPhotoRankings) setHTML("ratingscell", this.ratingHTML());
  
  // update view count
  var vc = getE("viewscell");
  if (vc) vc.innerHTML = this.viewCountHTML();		

  // options only available if selling prints
  var tr = getE("toprow");
  var trc1 = this.topRowCell(1);
  var trc2 = this.topRowCell(2);
  if (tr) {
    if ((trc1 == "") && (trc2 == "")) {
    
      try {
        tr.style.display = "none";
      } catch (e) {
        // ignore
      }
      
      setHTML("topRowCell_1", "");  
      setHTML("topRowCell_2", "");        
    } else {
    
      try {
        tr.style.display = "table-row";
      } catch(e) {
        try {
          tr.style.display = "block";
        } catch (e) {
          // ignore        
        }
      }
      
      setHTML("topRowCell_1", trc1);  
      setHTML("topRowCell_2", trc2);            
    }
  }
   
  // update anchor over image
  //if (this.allowOrigAccess) document.getElementById("afs").href = this.origHREF();
	
  // update caption
  setHTML("msgcaption", this.captionHtml());
	
  // allow photo comments
	if (this.parent.allowPhotoComments) setHTML("commentstd", this.commentHTML());
  
  // update type for info link
  var infoLink = getE("metaDataLink");
  if (infoLink) {
    if (this.isvideo) setHTML("metaDataLink", "More video info"); else setHTML("metaDataLink", "More photo info");
  } 
	
  this.busy(false);
}
  
  
// changes cursor to hourglass and back
slide.prototype.busy = function(isbusy) {
  if (!useragent.isie) return;
  var cursor = 'default';
	var buttoncursor = 'hand';
  if (isbusy) {
	  cursor = 'wait';
	  buttoncursor = 'wait';
	}
  document.body.style.cursor = cursor;	
  nextbutton.style.cursor = buttoncursor;
  prevbutton.style.cursor = buttoncursor;
}


    // helper routine to calculate whether buy prints allowed
  slide.prototype.allowBuyPrints = function() {
    return((this.parent.isGuest == false) || (this.allowGuestPurchases == true));
  }

  slide.prototype.albumid = function()
  {
     if (this.albumidstr == '') 
       return(this.parent.albumid)
     else
       return(this.albumidstr);
  }

  slide.prototype.groupid = function()
  {
     if (this.groupidstr == '') 
       return(this.parent.groupid)
     else
       return(this.groupidstr);
  }


  
  
  // constructor for slideshow
  function TSlideshow() {
   this.slides = [];
   this.transitions = [];
   this.albumidstr = null;
   this.groupidstr = null;
   this.hostname = null;
   this.userid = null;
   this.guid = null;
   this.isGuest = false;   
   //this.allowOrigAccess = false;
   //this.allowGuestPurchases = false;
   //this.allowGuestEdit = 'ynNo';
   //this.featurePasswordValidated = false;
   this.curIndex = 0;
   this.pictReturnUrl = null;
   this.curSelectionType = null;
   this.curSelection = null;
   this.baseURL = null;
   this.maxPicWidth = 640;
   this.maxPicHeight = 480;
   this.initialized = false;
   this.slideshowDelay = 5000;
   this.slideshowRunning = false;
   this.useWindowsMediaPlayer = true;
   this.transition = 0;
   this.useNewMP = null;
   this.allowVideo = false;
   this.slideShowShadow = "shadow";
   this.overbandwidth = false;
   this.currentvideoplayer = "none";
   this.backButtonURL = "/ftweb/images/common/back_button.gif";
   this.nextButtonURL = "/ftweb/images/common/next_button.gif";
   this.cartIconURL = "/ftweb/images/ft/ss_cart_icon.gif";
   this.infoIconURL = "/ftweb/images/ft/icons/ss_info_icon.gif";
   this.iconPath = "/ftweb/images/ft/icons/";
   this.isReal = false;
   this.allowPhotoComments = true;
   this.allowPhotoRankings = false;
   //this.useWatermarks = false;
   this.backgroundMusic = "";
   this.showGuestsEXIFIPTC = false;
   if (this.supportsTransitions()) this.loadTransitions();
   this.searchStr = null;
   this.showCaption = false;
   this.showFileName = false;
   this.showPictDate = false;
   this.sessionTimeoutSeconds = 1800;
   this.sessionTimerId = 0;
  }

  // pass in a newly created thumbnail to add it to the list
  TSlideshow.prototype.add = function (aslide) {
    aslide.parent = this;
    aslide.ndx = this.slides.length;
    this.slides[this.slides.length] = aslide;
    return aslide;
  } 

  TSlideshow.prototype.useNewMediaPlayer = function() {
    if (this.useNewMP == null) {
	    try {
		    var tmp = new ActiveXObject('WMPlayer.OCX');
		    this.useNewMP = (tmp != null);
	    } catch(exception) {
	      this.useNewMP = false;
	    }	
	  }
	  return(this.useNewMP);
  }

  TSlideshow.prototype.hideMusicPlayer = function() {
		var player = document.getElementById("mp3player");
		if (player) player.style.visibility = "hidden";
  }

  TSlideshow.prototype.showMusicPlayer = function() {
		var player = document.getElementById("mp3player");
		if (player) player.style.visibility = "visible";
  }


  TSlideshow.prototype.supportsTransitions = function() {
    return( (useragent.isie) && (useragent.version >= 5.5));
  }
  
  TSlideshow.prototype.addTransition = function(atransition) {
    atransition.parent = this;
	  atransition.ndx = this.transitions.length;
	  this.transitions[this.transitions.length] = atransition;  
  }
  
	TSlideshow.prototype.getBorderClass = function() {
		if (this.slideShowShadow == "none") return("");		
		if (this.slideShowShadow == "thinline") return("border_thinline");									
		if (this.slideShowShadow == "thickline") return("border_thickline");												
		
		if (useragent.isie) {
			if (this.slideShowShadow == "shadow") return("border_ieshadow");
			if (this.slideShowShadow == "dropshadow") return("border_iedropshadow");			
		} else {
			if (this.slideShowShadow == "shadow") return("border_shadow");
			if (this.slideShowShadow == "dropshadow") return("border_dropshadow");			
		}
		
		// default
		return("");
	}
	
  TSlideshow.prototype.getShadow = function() {
    if (this.slideShowShadow == "none") {
	    return("");
	  } else 
	  if (this.slideShowShadow == "dropshadow") {
      return("progid:DXImageTransform.Microsoft.dropShadow(color=gray, positive=true, offx=5, offy=5)");		
	  } else {
      return("progid:DXImageTransform.Microsoft.Shadow(color=gray, Direction=135, Strength=7)");	
	  }
  }
  
  
  TSlideshow.prototype.getTransition = function() {
    if ((this.transition == 0) || (this.supportsTransitions() == false)) {
	  return(null);
	} else {
	  var tmp = this.transition;
	  if (tmp == 1) tmp = Math.floor(Math.random() * (this.transitions.length - 3)) + 2;
	  if (tmp < 2) tmp = 2;
      return(this.transitions[tmp]);
	}
  }
  
  TSlideshow.prototype.loadTransitions = function() {
    this.addTransition( new TTransition("None", null));  
    this.addTransition( new TTransition("Random", "random"));
    this.addTransition( new TTransition("Barn", "progid:DXImageTransform.Microsoft.Barn(Duration=1,orientation=vertical)"));	
    this.addTransition( new TTransition("Blinds", "progid:DXImageTransform.Microsoft.Blinds(Duration=1,bands=20)"));		
    this.addTransition( new TTransition("Checker Board", "progid:DXImageTransform.Microsoft.Checkerboard(Duration=1,squaresX=20,squaresY=20)"));			
    this.addTransition( new TTransition("Fade", "progid:DXImageTransform.Microsoft.Fade(duration=1)"));				
    this.addTransition( new TTransition("Gradient Wipe", "progid:DXImageTransform.Microsoft.GradientWipe(duration=1)"));					
    this.addTransition( new TTransition("Inset", "progid:DXImageTransform.Microsoft.Inset()"));						
    this.addTransition( new TTransition("Iris", "progid:DXImageTransform.Microsoft.Iris(Duration=1,motion=out)"));							
    this.addTransition( new TTransition("Pixelate", "progid:DXImageTransform.Microsoft.Pixelate(maxSquare=10,duration=1)"));								
    this.addTransition( new TTransition("Radial Wipe", "progid:DXImageTransform.Microsoft.RadialWipe(Duration=1,wipeStyle=clock)"));									
    this.addTransition( new TTransition("Random Bars", "progid:DXImageTransform.Microsoft.RandomBars(Duration=1,orientation=vertical)"));										
    this.addTransition( new TTransition("Random Dissolve", "progid:DXImageTransform.Microsoft.RandomDissolve(Duration=1,orientation=vertical)"));											
    this.addTransition( new TTransition("Slide", "progid:DXImageTransform.Microsoft.Slide(Duration=1,slideStyle=push)"));												
    this.addTransition( new TTransition("Stretch", "progid:DXImageTransform.Microsoft.Stretch(Duration=1,stretchStyle=push)"));													
    this.addTransition( new TTransition("Strips", "progid:DXImageTransform.Microsoft.Strips(Duration=1,motion=rightdown)"));														
    this.addTransition( new TTransition("Wheel", "progid:DXImageTransform.Microsoft.Wheel(Duration=1,spokes=12)"));															
    this.addTransition( new TTransition("ZigZag", "progid:DXImageTransform.Microsoft.Zigzag(GridSizeX=32,GridSizeY=8)"));																
  }
  
  
 
  // called when next button clicked
  TSlideshow.prototype.next = function() {
    this.slides[this.curIndex].shutdownVideoPlayer();
 
    this.curIndex++;
    if (this.curIndex == this.slides.length)
      this.curIndex = 0;
    this.write(); 
    this.changeAd();
    this.startSessionTimer();
  }
  
  // called when previous button clicked
  TSlideshow.prototype.prev = function() {
    this.slides[this.curIndex].shutdownVideoPlayer();
	  
    this.curIndex--;
    if (this.curIndex < 0)
      this.curIndex = this.slides.length - 1;
    this.write(); 
    this.changeAd();
    this.startSessionTimer();    
  }
  
  TSlideshow.prototype.changeAd = function()
  {
    var AdFrameH = document.getElementById("AdFrameH");
    if (AdFrameH)
      AdFrameH.src = AdFrameH.src;
    var AdFrameV = document.getElementById("AdFrameV");
    if (AdFrameV)
      AdFrameV.src = AdFrameV.src;

  }
  
  // next previous navigation for slideshow
  TSlideshow.prototype.nextPrevNav = function() {
    var html = "";
		html += '<!-- next/prev navigation -->' + CRLF;
		html += '<table width=550 cellspacing=0 cellpadding=0 border=0>' + CRLF;
		html += ' <tr>' + CRLF;
		html += '  <td width=85 class=slideshowhdr align=right nowrap>' + this.curSelectionType + ': </td>' + CRLF;
		html += '  <td class=slideshowhdr><a class=slideshowhdr href="' + this.pictReturnUrl + '">' + unescape(this.curSelection) + '</a></td>' + CRLF;
		html += '  <td width=100 class=slideshowhdr align=right id=slidendx>' + (this.curIndex+1) + ' of ' + this.slides.length + '</td>' + CRLF;
		html += '  <td width=15>&nbsp;</td>' + CRLF;
		html += '  <td width=60>' + CRLF;
		html += '    <a href="javascript:slideshow.prev()">' + CRLF;
		html += '      <img id=prevbutton border=0 src="' + this.backButtonURL + '">' + CRLF;
		html += '    </a>' + CRLF;
		html += '  </td>' + CRLF;
		html += '  <td width=60>' + CRLF;
		html += '    <a href="javascript:slideshow.next()">' + CRLF;
		html += '      <img id=nextbutton border=0 src="' + this.nextButtonURL + '">' + CRLF;
		html += '    </a>' + CRLF;
		html += '  </td>' + CRLF;
		html += ' </tr>' + CRLF;
		html += '</table>' + CRLF;
		return(html); 
  }

  // next previous navigation for slideshow
  TSlideshow.prototype.nextPrevNavReal = function() {
    var html = "";
		html += '<!-- next/prev navigation -->';
		html += '<table width=550 cellspacing=0 cellpadding=0 border=0>';
		html += '  <tr>';
	
		html += '  <td width=165>&nbsp;</td>';
		html += '  <td width=60><a href="javascript:slideshow.prev()">';
		html += '    <img id=prevbutton border=0 src="' + this.backButtonURL + '">';
		html += '    </a></td>';
	
    html += '        <td width=100 class=slideshowhdr align=center id=slidendx>' + (this.curIndex+1) + ' of ' + this.slides.length + '</td>';
	
		html += '  <td width=60><a href="javascript:slideshow.next()">';
		html += '  <img id=nextbutton border=0 src="' + this.nextButtonURL + '">';
		html += '  </a></td>';
		html += '  <td width=165>&nbsp;</td>';
		
		html += '</tr>';
		html += '</table>'; 
		return html; 
  }

  
  // box containing image or video
  TSlideshow.prototype.imageBox = function() {
    var html = "";
	  html += '<!-- image  -->' + CRLF;
	  html += '<table width=540 height=360 cellspacing=0 cellpadding=0 border=0 style="margin-bottom:3px">' + CRLF;
	  //html += '<table width=540 height=480 cellspacing=0 cellpadding=0 border=0>' + CRLF;		
	  html += '  <tr>' + CRLF;
	  html += '    <td align=center valign=middle class=righttext>' + CRLF;
	  html += this.slides[this.curIndex] + CRLF;
	  html += '    </td>' + CRLF;
	  html += '  </tr>' + CRLF;
	  html += '</table>' + CRLF;  
    return(html);
  }
  
  TSlideshow.prototype.pauseMusic = function() {
  try {
    var plyr = document.getElementById("mp3player");
    if (plyr) plyr.sendEvent("PLAY", "false");
  } catch(e) {
    // ignore
  }
}

TSlideshow.prototype.startMusic = function() {
  try {
    var plyr = document.getElementById("mp3player");
    if (plyr) plyr.sendEvent("PLAY", "true");
  } catch(e) {
    // ignore
  }  
}

TSlideshow.prototype.musicPlayerHtml = function(murl,autostart) {
  try {
    if (true) {
      var so = new SWFObject("/ftweb/scripts/jw_player/player-licensed.swf", "mp3player", "250px", "18px", "6", "#888888");
      so.addVariable("file", murl);
      if (autostart) so.addVariable("autostart", "true"); else so.addVariable("autostart", "false");
      so.addVariable("repeat","always");
      so.addParam("allowscriptaccess", "always");
      so.addParam("wmode", "opaque");  
      so.addVariable("bufferlength", "1");          
      return so.getSWFHTML();
    } else {
      return '<EMBED id="mp3player" width=250 height=18 src="/ftweb/scripts/flash/mp3player.swf" FlashVars="volume=60&frontcolor=0xffffff&backcolor=0x336699&autostart=true&repeat=true&file=' + murl + '"></EMBED>';
    }
  } catch (e) {
    return "";
  }  
}

  

  // yellow info box at bottom of slideshow screen
  TSlideshow.prototype.slideInfo = function() {
    var html = "";
	var slide = this.slides[this.curIndex];	
		
	// moved mp3 player to under picture
	if (this.backgroundMusic != "") {
	  var encurl = encodeURIComponent(this.backgroundMusic);
      //html += '<table width=540><tr><td align=center><EMBED id="mp3player" width=250 height=18 src="/ftweb/scripts/flash/mp3player.swf" FlashVars="volume=60&frontcolor=0xffffff&backcolor=0x336699&autostart=true&repeat=true&file=' + encurl + '"></EMBED></td></tr></table><BR>';
      var autostart = !slide.isvideo;      
      html += '<table width=540><tr><td align=center>' + this.musicPlayerHtml(encurl,autostart) + '</td></tr></table><BR>';          
	}		

	html += '<!-- caption  and slideshow info box -->' + CRLF;
	html += '<table width=540 border=0 cellspacing=0 cellpadding=0>' + CRLF;
	html += '  <tr height=15>' + CRLF;
    if ((supportsYUI) && (!this.isGuest)) {
      var dsp = "visible";
      if (slide.isvideo) dsp = "hidden";
      html += '<td style="white-space:nowrap; width:45px; visibility:' + dsp + '" id="rotateIcons">';
      html += '<span><a href="javascript:slideshow.rotflip(0);"><img src="' + this.iconPath + 'editrotateleft.gif" border=0 title="Rotate picture left"></a></span>';
      html += '<span><a href="javascript:slideshow.rotflip(1);"><img src="' + this.iconPath + 'editrotateright.gif" border=0 title="Rotate picture right"></a></span>';
      html += '</td>' + CRLF;
    }
	
	// caption
        html += '    <td align=center>' + CRLF;
	html += '      <table width=480 cellspacing=0 cellpadding=0><tr><td align=center id=msgcaption>' + CRLF;
	html += slide.captionHtml() + CRLF;
	html += '      </td></tr></table>' + CRLF;
        html += '    </td>' + CRLF;
   	html += '  </tr>' + CRLF;
	
	// pict date and file name
        if ((this.showPictDate) || (this.showFileName)) {
          html += '  <tr height=15><td';
          if ((supportsYUI) && (!this.isGuest)) html += ' colspan=2';
          html += ' class=slideshowbtmtxt align=center id=msgpictdate>' + slide.pictdatefilenameStr() + '</td></tr>' + CRLF;
        }	

	// gps info
	//html += '  <tr height=15><td';
    //if ((supportsYUI) && (!this.isGuest)) html += ' colspan=2';
    //html += ' class=slideshowbtmtxt align=center id=msggpsdata>' + slide.pictGpsStr() + '</td></tr>' + CRLF;	
	
	// info window
	html += '  <tr><td align=center';
    if ((supportsYUI) && (!this.isGuest)) html += ' colspan=2';
    html += '>' + slide.infoWindow() + '</td></tr>' + CRLF;
	html += '</table>' + CRLF;  
	
	//if (this.backgroundMusic != "") {
	//	var encurl = encodeURIComponent(this.backgroundMusic);
	//	html += '<BR><table width=540><tr><td align=center><EMBED id="mp3player" width=250 height=18 src="/ftweb/scripts/flash/mp3player.swf" FlashVars="volume=60&frontcolor=0xffffff&backcolor=0x336699&autostart=true&repeat=true&file=' + encurl + '"></EMBED></td></tr></table>';
	//}		
	return html;
  }


  // only called once - dump html to screen
  TSlideshow.prototype.toString = function() {
    var html = "";
    if (this.isReal) html += this.nextPrevNavReal(); else html+= this.nextPrevNav() +  "<BR>" + CRLF;
	  html += this.imageBox() + this.slideInfo();		
    this.startSessionTimer();
    return (html);
  }
  
  // preload next image
  TSlideshow.prototype.preload = function() {
    var tmpIndex = this.curIndex + 1;
	  if (tmpIndex <= this.slides.length - 1) {
	    var slide = this.slides[tmpIndex];
	    slide.loadImage();
	  }
  }



  TSlideshow.prototype.drawReflection = function() {
    var slide = this.slides[this.curIndex];  
    slide.drawReflection();
  }

  TSlideshow.prototype.logView = function() {
    // google logging
    try {
      var slide = this.slides[this.curIndex];
      logGoogleView(this.userid, slide.albumid(),slide.groupid(),this.curIndex);
    } catch(e) {
      //alert(e.message);
      // ignore
    }
  }

  // put the thumbails in the cell they are supposed to be in
  // optimized not to do this unless the # of thumbs per row changes
  TSlideshow.prototype.write = function() {
    var slide = this.slides[this.curIndex];  

    if (this.initialized == false) {
      if (document.getElementById) tc = document.getElementById("sscontent"); else tc = sscontent;	
      tc.innerHTML = this;
      this.initialized = true;
      if (useragent.isie) {
        if (this.slideShowShadow == "reflection") slide.drawReflection();				
      } else {
	if (this.slideShowShadow == "reflection") setTimeout("slideshow.drawReflection()",250);				
      }
	
      if (slide.isvideo) slide.startVideo();
    } else {
      slide.updateScreen();

      // only log when subsuquent and not first views
      this.logView();
    }
		
    var rheight = slide.displayheight / 10;
    //Reflection.add(document.getElementById("slidepic"), {height:0.25, opacity:0.6});

    // log
		
    // set timer to load next picture in slideshow
    window.setTimeout("slideshow.preload()", 1000);
    //var hdr = document.getElementById("headertable");
    //if (hdr) hdr.outerHTML = '<!-- no header -->';
  }

  // buy print of current picture
  TSlideshow.prototype.buyCurrentPrint = function() {
    var slide = this.slides[this.curIndex];
    if (slide.allowBuyPrints())
    {
  	if (slide.isvideo) {
	    alert("Sorry, you cannot buy prints from a video."); 
		} else {
			//BuyCurrentPrintDlg(slide.pictid, slide.ndx);
			//BuyCurrentPrintFS(slide.ndx);
			if (supportsYUI) BuyCurrentPrintDlg(slide.pictid, slide.ndx, slide.albumid(), slide.groupid()); 
                        else BuyCurrentPrintFS(slide.ndx, slide.isvideo, slide.albumid(), slide.groupid());
		}
    }
    else
      alert('You cannot buy prints of this photo.');
  }

  // buy digital download of current picture
  TSlideshow.prototype.buyCurrentImage = function() {
    var slide = this.slides[this.curIndex];
    if (slide.allowBuyPrints())
    {
  	if (slide.isvideo) {
	    alert("Sorry, you cannot buy digital downloads of a video."); 
		} else {
		  if (supportsYUI) BuyCurrentImageDlg(slide.pictid, slide.ndx, slide.albumid(), slide.groupid()); 
                  else BuyCurrentPrintFS(slide.ndx, slide.isvideo, slide.albumid(), slide.groupid());
		}
    }
    else
      alert('You cannot purchase a digital download of this photo.');
  }


  // buy gifts of current picture
  TSlideshow.prototype.buyCurrentGift = function() {
    var slide = this.slides[this.curIndex];
    if (slide.allowBuyPrints())
    {
	  if (slide.isvideo) alert("Sorry, you cannot buy a photo gift from a video.");  
          else BuyCurrentGiftFS(slide.pictid, slide.width, slide.height, slide.isvideo, slide.albumid(), slide.groupid());
    }
    else
      alert('You cannot purchase gifts of this photo.');
  
  }


  // show exif info for currently selected picture
  TSlideshow.prototype.showCurrentEXIF = function() {
    var slide = this.slides[this.curIndex];  
		if (supportsYUI) {
      if ((slide.extension.toUpperCase() == '.JPG') || (slide.isvideo)) {
				showExifDialog(slide.pictid); 
			} else {      
 		  	alert("Not supported for this image type.");			
			}
		} else {
    	if ((slide.extension.toUpperCase() == '.JPG') || (slide.isvideo)) exifwindow(slide.pictid); else alert("Not supported for this image type.");			
		}

  }

// show captions/tags for currently selected picture
  TSlideshow.prototype.showCaptionTags = function() {
    var slide = this.slides[this.curIndex];  
		if (supportsYUI) {
      var Vp = document.getElementById("videoplayer");
      if (Vp) Vp.style.visibility = "hidden";
      if ((this.isGuest == false) || (slide.allowGuestEdit == 'ynYes'))
        showpictproptiesDialog(slide)
      else
      if (slide.allowGuestEdit == 'ynYesPwd')
      {
        if (slide.featurePasswordValidated)
          showpictproptiesDialog(slide)
        else
          showfeaturePwdDialog(slide);
      }
            
    }
  }


  // advances the slideshow for each time tick
  TSlideshow.prototype.autoadvance = function() {
    if (this.slideshowRunning) {
      var slide = this.slides[this.curIndex];  	
	    if ((slide.isvideo == false) && (slide.picture.complete)) this.next();
      setTimeout("slideshow.autoadvance()", this.slideshowDelay);	
    }
  }

  // called at end of video event
  TSlideshow.prototype.videoadvance = function() {
    if (this.slideshowRunning) {
      this.slides[this.curIndex].shutdownVideoPlayer();  	
	    this.next();
      //setTimeout("slideshow.autoadvance()", this.slideshowDelay);	
    }
  }


  // called by clicking the start/stop slideshow button
  TSlideshow.prototype.toggleStartStop = function() {
    var stopss = /stopslideshow_icon/g;
    var startss = /startslideshow_icon/g;
    this.slideshowRunning = !this.slideshowRunning;
    if (this.slideshowRunning) {
      imgstartss.src = imgstartss.src.replace(startss, 'stopslideshow_icon');		  
	    atstartss.innerHTML = "Stop Slideshow";
      setTimeout("slideshow.autoadvance()", this.slideshowDelay);
	  } else {
      imgstartss.src = imgstartss.src.replace(stopss, 'startslideshow_icon');
      //imgstartss.src = "/ftweb/images/ft/stopslideshow_icon.gif";		
	    atstartss.innerHTML = "Start Slideshow";	  
	  }
  }
  
  // create a link to the current picture
  TSlideshow.prototype.createLink = function() {
    var slide = this.slides[this.curIndex]; 
    if (supportsYUI) 
    {
      var Vp = document.getElementById("videoplayer");
      if (Vp) 
        Vp.style.visibility = "hidden";
      showpictLinkDialog(slide);
    }
    else
    if (slide.isprivate) pictureLinkFS(slide.pictid, 1); else pictureLinkFS(slide.pictid, 0);
  }

  // create a link to the current picture
  TSlideshow.prototype.sendToBlog = function() {
    var slide = this.slides[this.curIndex];  
	  if (slide.isprivate) {
	    window.location = '/ftweb/bin/ft.dll/blogpost?pictid=' + slide.pictid + '&priv=1&mode=fd';
  	} else {
	    window.location = '/ftweb/bin/ft.dll/blogpost?pictid=' + slide.pictid + '&priv=0&mode=fd';	
  	}
  }
  
  // send current picture to phone
  TSlideshow.prototype.sendToPhone = function() {
    var slide = this.slides[this.curIndex];  
	  if (slide.isvideo) alert("Sorry, you cannot send a video to a phone."); else window.location = '/ftweb/bin/ft.dll/sendtosprintphone?pictid=' + slide.pictid;
  } 

  // send current picture to phone
  TSlideshow.prototype.setPricePlan = function() {
    var slide = this.slides[this.curIndex];  
	  if (slide.isvideo) alert("Sorry, you can only set pricing on prints and not videos."); else window.location = '/ftweb/bin/ft.dll/setpictureplan?pictid=' + slide.pictid + '&ndx=' + this.curIndex;
  } 


  // change to edit mode for current picture
  TSlideshow.prototype.editCurrentPicture = function() {
    var slide = this.slides[this.curIndex];  
    window.location = this.baseURL + '&slideshow=0&editmode=t&ndx=' + this.curIndex;
  } 

  // change to edit mode for current picture
TSlideshow.prototype.deleteCurrentPicture = function() {
    var slide = this.slides[this.curIndex];  
    var url = '/ftweb/bin/ft.dll/deletepic?albumid=' + slide.albumid() + '&groupid=' + slide.groupid() + '&userid=' + this.userid + '&ndx=' + this.curIndex + '&pictid=' + slide.pictid + '&from=detailfs';
    if ((this.searchStr != null) && (this.searchStr != ''))      
      url += '&search=' + this.searchStr
	  //alert(url);
    if (confirm("Do you really want to delete the current photo?")) window.location = url;
  } 

  // create a greeting card from current picture
  TSlideshow.prototype.makeCurrentCard = function() {
    var slide = this.slides[this.curIndex];  
    if (slide.allowBuyPrints())
    { 
	if (slide.isvideo) alert("Sorry, you cannot create a card from a video."); 
        else MakeCurrentCardFS(slide.pictid, slide.width, slide.height, slide.isvideo, slide.albumid(), slide.groupid());
    }
    else
     alert('You can not create a greeting card of this photo.');
  } 
 
  // change the display size for the slideshow
  TSlideshow.prototype.changeViewSize = function(size) {
    window.location = this.baseURL + '&vs=' + size + '&ndx=' + this.curIndex;
  }
  
  // change the display size for the slideshow
TSlideshow.prototype.changeVideoMode = function(mode) {
  var slide = this.slides[this.curIndex];  
  document.cookie = "vidPref=" + mode;
  this.slides[this.curIndex].shutdownVideoPlayer();
  this.write();  
}

  
  // print the current picture - always activeX since dynamic slideshow
  // only works for IE anyway
  TSlideshow.prototype.printCurrentPicture = function() {
    var slide = this.slides[this.curIndex];    
	  if (slide.isvideo) {
	    alert("Sorry, you cannot print a video.");
	  } else {
			if (useragent.supportsActiveX) window.location = '/ftweb/bin/ft.dll/printactiveX?pictid=' + slide.pictid;	
			else
			if (useragent.supportsPlugins) window.location = '/ftweb/bin/ft.dll/printnetscape.html?pictid=' + slide.pictid;
		  else {
			  //alert("printing now supported");
				PrintCurrent('/ftweb/bin/ft.dll/orig?pictid=' + slide.pictid, slide.width, slide.height);
			}
		}
  }
  
  TSlideshow.prototype.usePopupViewer = function() {
    var slide = this.slides[this.curIndex];    
    DetailWin(this.userid, this.curIndex, slide.albumid(), slide.groupid(), this.searchStr);
  }
  
  TSlideshow.prototype.viewAllComments = function () {
    var slide = this.slides[this.curIndex];    
    ViewCommentsWin(this.userid, this.curIndex, slide.albumid(), slide.groupid(), slide.pictid);  
  }
  
  TSlideshow.prototype.showMap = function() {
    var slide = this.slides[this.curIndex];
    var url = this.baseURL + '&slideshow=0&mapmode=t&ndx=' + this.curIndex;	
	//var url = '/ftweb/bin/ft.dll/showphotolocation?pictid=' + slide.pictid + '&ssseq=' + this.curIndex;
	window.location = url;
  }
  
  TSlideshow.prototype.addNewComment = function () {
    var slide = this.slides[this.curIndex];    
    AddCommentWin(this.userid, this.curIndex, slide.albumid(), slide.groupid(), slide.pictid);  
  }
	
  TSlideshow.prototype.debugVideo = function() {
    var slide = this.slides[this.curIndex];
    var debugInfo = slide.debugInfo() + vplayer.debugInfo(slide.imageVideoURL());
    alert(debugInfo);
  }
	
	
  TSlideshow.prototype.checkAutoStart = function(url) {
    if (url.indexOf("autostart=1") > 0) this.toggleStartStop();
  }

  TSlideshow.prototype.ssratehint = function(stars) {
    var slide = this.slides[this.curIndex];				
	if (slide.needRatingHack()) setTimeout("ratehint(" + stars + ")", 10); else ratehint(stars);
  }

  TSlideshow.prototype.ssrateout = function() {
    var slide = this.slides[this.curIndex];		
	if (slide.needRatingHack()) setTimeout("rateout()",10); else rateout();
  }

  TSlideshow.prototype.ssrateitem = function(stars) {
    var slide = this.slides[this.curIndex];		
	if (slide.needRatingHack()) setTimeout('rateitem("' + slide.pictid + '",' + stars + ')', 10); else rateitem(slide.pictid, stars);
  }

  TSlideshow.prototype.showExtraMenu = function() {
		return;
		var photoBarContent = document.createElement("div");
    photoBarContent.setAttribute('id', 'urlhint');
    photoBarContent.className = "urlhint";
    document.body.appendChild(photoBarContent);
		photoBarContent.innerHTML = "If you are trying to get the URL of this photo by right clicking on it, please use the 'Create Link' option to do this.";	
		var region = YD.getRegion("slidepic");
		var x = region.left;
		var w = region.right - region.left;
		if (w > 300) {
			x = x + ((w - 300) / 2);
		} else {
			x = x - ((300 - w) / 2);
		}
		
		var h = region.bottom - region.top;
		if (h < 300) {
			var y = region.bottom;
		} else {
			var y = region.bottom - 65;
		}
		
		YD.setXY(photoBarContent, [x, y]);
		//alert(region.toString());
	}
	
	function removeFromDOM(id) {
    if (id != '') {
      if (YD.inDocument(id)) {
        purgeObj =  YD.get(id);
        YE.purgeElement(purgeObj, true);
        while(purgeObj.hasChildNodes() == true) {
          purgeObj.removeChild(purgeObj.childNodes[0]);
        }
        purgeObj.parentNode.removeChild(purgeObj);
      }
    }
  }
	
	TSlideshow.prototype.hideExtraMenu = function() {
		return;
	  removeFromDOM('urlhint');
	}
	
	TSlideshow.prototype.rightClickHint = function() {	
		// only show this once
		var seenBefore = GetCookie("shownRightClickHint");
		if (seenBefore == "1") return true;
		
		var html = "Wanting to grab the URL for this photo so you can put it in a forum, auction, or other 3rd party site?";
		html += "<BR><BR>Use the <i>Create Link</i> option at the left, to get web friendly URLs.  The create link option";
		html += " not only gives you different size options, but also gives you either a URL or HTML that you can easily";
		html += " paste into other websites.";
		//showMessageDialog("Hint...", html);
		document.cookie = "shownRightClickHint=1";
		showNonModalMessageDialog("Hint...", html);
		return false;
	}

// rotate flip for selected photo
  TSlideshow.prototype.rotflip = function(action) {
    var slide = this.slides[this.curIndex];  
    if (supportsYUI) {
      if (slide.isvideo) alert("Sorry, you can only rotate pictures (rotating of videos is not supported)"); else rotflip(action, slide);
    }
  }

  
TSlideshow.prototype.startSessionTimer = function() {
  if (this.sessionTimerId) {
    clearTimeout(this.sessionTimerId);  
    this.sessionTimerId = 0;
  }
  this.sessionTimerId = setTimeout("slideshow.sessionTimedOut()", this.sessionTimeoutSeconds * 1000);
}

TSlideshow.prototype.sessionTimedOut = function() {
  if (this.sessionTimerId) {
    clearTimeout(this.sessionTimerId);  
    this.sessionTimerId = 0;
  }
  window.location = "/ftweb/bin/ft.dll/loginexpired?product=" + this.webProduct;
}

